<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>管理编辑</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/web/res/css/xadmin.css">
    <script src="/web/res/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/web/res/js/xadmin.js"></script>
    <script type="text/javascript"  src="/web/res/kindeditor4110/kindeditor-min.js" charset="utf-8"></script>
</head>

<body style="background-color: white;">
    <div class="layui-fluid" id="orderEdit">
        <form class="layui-form layui-form-pane" id="formsubmit" name="formsubmit" action="/btmuji/save">

            <input type="hidden" name="id" id="id" value="${(muji.id?c)!''}"/>
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend class="form-title">募集信息</legend>
            </fieldset>

            <div class="layui-form-item">
                <label class="layui-form-label">募集标题</label>
                <div class="layui-input-block">
                    <input type="text"  name="biaoti" required="required" placeholder="请输入募集标题" value="${(muji.biaoti)!''}" autocomplete="off" class="layui-input" >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">总募集数量</label>
                <div class="layui-input-block">
                    <input type="number"  name="zongnum" required="required" placeholder="请输入募集数量" value="${(muji.zongnum?c)!''}" autocomplete="off" class="layui-input" >
                </div>
            </div>

            <#if muji?exists && muji.id?exists>

            <div class="layui-form-item">
                <label class="layui-form-label">已募集数量</label>
                <div class="layui-input-block">
                    <input type="number" readonly="readonly" required="required"  name="yinum" value="${(muji.yinum?c)!''}" autocomplete="off" class="layui-input" >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">剩余数量</label>
                <div class="layui-input-block">
                    <input type="number" readonly="readonly" required="required"  name="shengyvnum" value="${(muji.zongnum- muji.yinum)?c ! ''}" autocomplete="off" class="layui-input" >
                </div>
            </div>


            </#if>

            <div class="layui-form-item">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-block">
                    <#if muji?exists && muji.id?exists>
                    <input type="text" name="start" readonly="readonly" <#if muji?exists && muji.id?exists>readonly="readonly"</#if>  value="<#if muji?exists && muji.starttime?exists>${(muji.starttime?string('yyyy-MM-dd'))!}</#if>" autocomplete="off" class="layui-input" >
                    <#else>
                    <input type="text" id="start" name="start" placeholder="请输入开始时间"  value="<#if muji?exists && muji.starttime?exists>${(muji.starttime?string('yyyy-MM-dd'))!}</#if>" autocomplete="off" class="layui-input" >
                    </#if>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-block">
                    <#if muji?exists && muji.id?exists>
                    <input type="text" name="end" readonly="readonly" placeholder="请输入结束时间" value="<#if muji?exists && muji.endtime?exists>${(muji.endtime?string('yyyy-MM-dd'))!}</#if>" autocomplete="off" class="layui-input" >
                    <#else>
                    <input type="text" id="end"  name="end"   placeholder="请输入结束时间" value="<#if muji?exists && muji.endtime?exists>${(muji.endtime?string('yyyy-MM-dd'))!}</#if>" autocomplete="off" class="layui-input" >
                    </#if>
                </div>
            </div>







            <!--<div class="layui-form-item" pane>-->
                <!--<label class="layui-form-label">启用状态</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<input type="checkbox" name="state" value="1" lay-skin="switch" lay-text="启用|不启用"  <#if muji?exists && muji.state?exists && (muji.state)?number == 1>checked</#if> >-->
                <!--</div>-->
            <!--</div>-->



            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="button" class="layui-btn layui-btn-radius" lay-submit lay-filter="save" >&emsp;保存&emsp;</button>
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" onclick="xadmin.close()">&emsp;返回&emsp;</button>
                </div>
            </div>
        </form>
    </div>


    <script>
        KindEditor.ready(function(K) {
            var editor1 = K.create('textarea[id="content"]', {
                cssPath : '/web/res/kindeditor4110/plugins/code/prettify.css',
                uploadJson : '/btnotice/fileUpload',
                fieldName : 'imgFile',
                allowImageRemote : false,
                items : ['source', '|','justifyleft', '|','justifycenter', '|','justifyright', '|','justifyfull', '|','fontname', '|','fontsize', '|','forecolor', '|','hilitecolor', '|','bold', '|','italic', '|','underline', '|','strikethrough', '|','removeformat','|','image'],
                afterBlur: function () {this.sync(); }//******这一步非常重要，如果遗漏，则后台无法接收到数据。
            });
            prettyPrint();
        });





        layui.use(['laydate', 'form', 'table'], function () {
            let $ = layui.$;
            var laydate = layui.laydate;
            var form = layui.form;
            laydate.render({
                elem: '#start'
                ,type: 'date' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end'
                ,type: 'date' //指定元素
            });
            form.render();
            $("#urlitem").hide();
            $("#contentitem").show();
            $.fn.extend({
                serializeObject: function() {
                    var obj = {}; //声明一个对象
                    $.each(this.serializeArray(), function(index, field) {
                        obj[field.name] = field.value; //通过变量，将属性值，属性一起放到对象中
                    })
                    return obj;
                }
            });


            form.on('submit('+$("button[lay-submit]:eq(0)").attr("lay-filter")+')', function(data){
                layer.confirm('确认要保存吗？', function (index) {
                    ajaxPost($,$("#formsubmit").attr("action"),$("#formsubmit").serializeObject(),function (data) {
                        if (data.code == 0) {
                            layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                                xadmin.father_reload();
                            });
                        } else {
                            layer.msg(data.msg, {icon: 2, time: 3000}, function(){
                            });
                        }
                    });
                });
            });
        });

    </script>

    <!--<script>-->
        <!--layui.use('form',function () {-->
            <!--let $ = layui.$;-->
            <!--var form = layui.form;-->
            <!--form.render();-->

            <!--$.fn.extend({-->
                <!--serializeObject: function() {-->
                    <!--var obj = {}; //声明一个对象-->
                    <!--$.each(this.serializeArray(), function(index, field) {-->
                        <!--obj[field.name] = field.value; //通过变量，将属性值，属性一起放到对象中-->
                    <!--})-->
                    <!--return obj;-->
                <!--}-->
            <!--});-->

            <!--form.on('submit('+$("button[lay-submit]:eq(0)").attr("lay-filter")+')', function(data){-->

                <!--layer.confirm('确认要保存吗？', function (index) {-->

                    <!--ajaxPost($,$("#formsubmit").attr("action"),$("#formsubmit").serializeObject(),function (data) {-->
                        <!--if (data.code == 0) {-->
                            <!--layer.msg(data.msg, {icon: 1, time: 1000}, function(){-->
                                <!--xadmin.father_reload();-->
                            <!--});-->
                        <!--} else {-->
                            <!--layer.msg(data.msg, {icon: 2, time: 3000}, function(){-->
                                <!--xadmin.close();-->
                            <!--});-->
                        <!--}-->
                    <!--});-->
                <!--});-->
            <!--});-->
        <!--});-->
    <!--</script>-->
</body>

</html>